<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

//配置式路由
/*return [
    '__pattern__' => [
        'name' => '\w+',
    ],
    '[hello]'     => [
        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
        ':name' => ['index/hello', ['method' => 'post']],
    ],

];*/
//动态路由
use think\Route;
//Route::rule("hello","sample/Test/hello");
//$prefixUrl = '/zerg/public/';
//Route::rule('路由表达式', '路由地址','请求类型','路由参数（数组）','变量规则（数组）');
//Route::rule('hello', 'sample/Test/hello','GET|POST', ['https'=>false]);
//Route::rule('hello', $prefixUrl.'Test/hello','GET|POST', ['https'=>false]);
//Route::post('hello/:id','sample/Test/hello');
//Route::get('api/v1/banner/:id', 'api/v1.Banner/getBanner');
Route::get('api/:version/banner/:id', 'api/:version.Banner/getBanner');

Route::get('api/:version/theme', 'api/:version.Theme/getSimpleList');
Route::get('api/:version/theme/:id', 'api/:version.Theme/getComplexOne');

/*Route::get('api/:version/product/:id', 'api/:version.Product/getOne',[],['id'=>'\d+']);
Route::get('api/:version/product/recent', 'api/:version.Product/getRecent');
Route::get('api/:version/product/by_category', 'api/:version.Product/getAllInCategory');
//放在最下面防止和recent冲突
//Route::get('api/:version/product/:id', 'api/:version.Product/getOne');*/

//路由分组
Route::group('api/:version/product',function (){
   Route::get('/:id','api/:version.Product/getOne',[],['id'=>'\d+']);
    Route::get('/recent','api/:version.Product/getRecent');
    Route::get('/by_category','api/:version.Product/getAllInCategory');
});

Route::get('api/:version/category/all', 'api/:version.Category/getAllCategories');

Route::post('api/:version/token/user','api/:version.Token/getToken');

Route::post('api/:version/address','api/:version.Address/createOrUpdateAddress');

/*Route::get('api/:version/second','api/:version.Address/second');
Route::get('api/:version/third','api/:version.Address/third');*/

Route::post('api/:version/order','api/:version.Order/placeOrder');


//Route::get('api/v1/banneritem/:id', 'api/v1.BannerItem/getBannerItem');
//Route::any();